<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../../js/jquery-1.9.1.min.js"></script>
<script src="../../js/angular.min.js"></script>

<body ng-app="zhengmian_baobian" ng-controller="zmbbCtrl">
<table align="center">
    <tr>
        <td></td>
        <td style="BORDER-right: #000000 1px solid;"></td>
        <td class="tWidth10" colspan="{{width+1}}" style="text-align:center;BORDER-right: #000000 1px solid;">{{product.t_width}}</td>
    </tr>
    <tr>
        <td style="border-bottom: #000000 1px solid;"></td>
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px solid;"></td>
        <td class="wBaobian10" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px solid;">
            {{product.w_baobian}}
        </td>
        <!--<c:forEach var="i" begin="1" end="${width}" varStatus="status">-->
        <td ng-repeat="singleWidth in eachWidth" style="width:51px;BORDER-right: #000000 1px solid;border-bottom: #000000 1px solid;">1024</td>
        <!--</c:forEach>-->
        <td class="wBaobian10" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px solid;">
            {{product.w_baobian}}
        </td>
    </tr>
    <tr>
        <td class="tHeight10" rowspan="3" style="border-bottom: #000000 1px solid;">{{product.t_height}}</td>
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px solid;">{{product.h_baobian}}</td>
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
        <!--<c:forEach var="i" begin="1" end="${width}" varStatus="status">-->
        <td ng-repeat="singleWidth in eachWidth" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
        <!--</c:forEach>-->
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
    </tr>
    <tr>
        <td class="firstHeight10" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;">{{product.firstHeight}}
        </td>
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
        <!--<c:forEach var="i" begin="1" end="${width}" varStatus="status">-->
        <td ng-repeat="singleWidth in eachWidth" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/td.jpg);"></td>
        <!--</c:forEach>-->
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
    </tr>
    <tr>
        <td class="hBaobian10" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;">{{product.h_baobian}}
        </td>
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
        <!--<c:forEach var="i" begin="1" end="${width}" varStatus="status">-->
        <td ng-repeat="singleWidth in eachWidth" style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
        <!--</c:forEach>-->
        <td style="BORDER-right: #000000 1px solid;border-bottom: #000000 1px
        solid;background-image:url(../static/img/baobian.jpg);"></td>
    </tr>

</table>
</body>
<script src="../../globalVar.js"></script>
<script>
    var app = angular.module('zhengmian_baobian', []);
    app.controller('zmbbCtrl', function ($scope, $http) {

        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)return unescape(r[2]);
            return null;
        }

        $scope.width = parseInt(GetQueryString("width"));
        $scope.height = parseInt(GetQueryString("height"));


        $scope.token = localStorage.getItem("token");
        var modelId = localStorage.getItem("modelId");
        if (modelId === null) {
            $scope.modelId = 1;
        } else {
            $scope.modelId = modelId
        }

        $http({
            method: "GET",
            url: url + "/product/zhengmianbaobian?token=" + $scope.token + "&productId=" + $scope.modelId + "&width=" + $scope.width + "&height=" + $scope.height
        }).then(
            function success(response) {
                //console.log(response.data.obj);
                $scope.product = response.data.obj;
                //console.log("dd"+$scope.product.t_width);
                $(".tWidth10").css("width", parseInt($scope.product.t_width) / 20 + "px");
                $(".wBaobian10").css("width", parseInt($scope.product.w_baobian) / 20 + "px");
                $(".tHeight10").css("height", parseInt($scope.product.t_height) / 20 + "px");
                $(".firstHeight10").css("height", parseInt($scope.product.firstHeight) / 20 + "px");
                $(".hBaobian10").css("height", parseInt($scope.product.h_baobian) / 20 + "px");
            },
            function error(response) {
                location.href = "login.html";
            }
        );



        console.log($scope.width);

        $scope.eachWidth = [];
        for (var i = 1; i < $scope.width; i++) {
            $scope.eachWidth.push(i);
        }

        $scope.eachHeight = [];
        for (var j = 1; j < $scope.height; j++) {
            $scope.eachHeight.push(j);
        }

        $scope.eachHeightExceptMax = [];
        for (var k = 1; k < $scope.height - 1; k++) {
            $scope.eachHeightExceptMax.push(k);
        }
    });
</script>
</html>